// 考勤明细状态
export type AttendanceStatus = 1 | 2 | 3 | 4

export type PlanType = "onduty" | "offduty"

// 修改考勤状态请求时的数据格式
export interface AttendanceStatusRequest {
    id?: number|string // ID
    kaoqin_status?: AttendanceStatus // 考勤状态
    note?: string // 备注
    kaoqin_time?:any
    plan_type?:any
}

// 考勤信息返回的数据格式
export interface AttendanceResponse {
    userid?: string // ID
    dept_id?: string // 部门 ID
    locattionOfWork?: string // 办公地点
    shop_id?: string // 门店ID
    shop_name?: string // 门店名称
    mobile?: string // 手机号
    username?: string // 姓名
    workNumber?: string // 工号
    attendanceRecord: AttendanceRecord[] // 考勤明细
    total_pages?: number // 分页的总页数
    typeOfEmployment?: string // 聘用形式
}

// 考勤明细
export interface AttendanceRecord {
    worktimes?: any
    day?: string // 日期
    day_status?: string[]
    day_check_status?: AttendanceRecordDayCheckStatus[]
}

export interface AttendanceRecordDayCheckStatus {
    id?: number
    seq?: number
    plan_type?: PlanType
    plan_time?: string
    actually_time?: string
    actually_place?: string
    actually_status?: number
    actually_group?: string
    flag?: string // 显示在 actually_status 右边的内容
    subflag?: string // 显示在 flag 右边的内容
    attendanceDays?:string
}

// 考勤明细状态有多少个
export const ATTENDANCE_STATUS_QUANTITY = 5

// 考勤明细状态有多少个能选择
export const ATTENDANCE_STATUS_QUANTITY_select = 3

export function planType(planType: PlanType) {
    switch (planType) {
        case "onduty":
            return "上班"
        case "offduty":
            return "下班"
    }
}

// 将考勤明细状态翻译为中文
export function status(attendanceStatus: AttendanceStatus | number) {
    switch (attendanceStatus) {
        case 1:
            return "正常"
        case 2:
            return "迟到"
        case 3:
            return "早退"
        case 4:
            return "缺卡"
    }
}
